home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 25
/
Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso
/
Aminet
/
comm
/
misc
/
MakeFTPScript.lha
/
MakeFTPScript.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1998-04-03
|
2KB
|
69 lines
/* MakeFTPScript v1.2 by Grzegorz Fitrzyk SP9WUN (sp9wun@sr9zaa.ampr.org)
usage: rx rexx:MakeFTPScript.rexx ADDRESS/K SOURCE/K DEST/K README/S
ex.: rx rexx:MakeFTPScript.rexx ftp.wustl.edu ram:recent ram:script readme
*/
parse arg ADDRESS source destin readflag
parse var readflag ' ' readfl
MODE=''
total=0
readfl=upper(readfl)
options results
if Open(loadit, source, 'Read') then do /* Open source file.*/
if Open(Saveit, destin, 'Write') then do /* Open destination file. */
do forever
line=Readln(loadit)
if line="" then leave
parse var line '|'. header
if header="" then do
if line~="|" then do
call makeline
end
end
end
end; else call error_write
end; else call error_read
say 'Total size of requested files 'total'KB'
say 'Conversion succesfull.'
quitit:
call close(saveit)
call close(loadit)
exit
error_read:
say 'Cant find source file: 'source
call quitit
error_write:
say 'Cant write destination file 'dest
call quitit
makeline:
parse var line filename direct size rest
linecom='ncftp'||MODE||' '||ADDRESS||':'||'pub/aminet/'||direct||'/'||filename
call writeln(saveit,linecom)
exten=right(size,1)
tt=pos('+',size)
if tt>0 then size=left(size,tt-1)
temp=length(size)
size=left(size,temp-1)
size=translate(size,,' ')
if exten="M" then size=size*1024
total=total+size
if readfl="README" then call doreadme
return
doreadme:
dlug=length(filename)
readname=left(filename,dlug-3)
linecom='ncftp'||MODE||' '||ADDRESS||':'||'pub/aminet/'||direct||'/'||readname||'readme'
call writeln(saveit,linecom)
return